package com.dachuang.canjiren.controller;


import com.dachuang.canjiren.service.VolunteerService;
import com.dachuang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/canjiren/volunteer")
public class VolunteerController {
    @Autowired
    private VolunteerService volunteerService;

    @GetMapping("selectInfo")
    R selectInfo(Integer id){
        return volunteerService.selectInfo(id);
    }

    @GetMapping("insertVolunteer")
    R insertVolunteer(@RequestParam(value = "theme",required = false) String theme,
                     @RequestParam(value = "content",required = false) String content,
                     @RequestParam(value = "openTime",required = false)String openTime,
                     @RequestParam(value = "endTime",required = false)String endTime,
                     @RequestParam(value = "sponsor",required = false)String sponsor){
        return volunteerService.insertVolunteer(theme,content,openTime,endTime,sponsor);
    }

    @GetMapping("selectVolunteerList")
    R selectActivityList(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                         @RequestParam(value = "pageSize",required = false) Integer pageSize,
                         @RequestParam(value = "keyword",required = false) String keyword){
        return volunteerService.selectVolunteerList(pageNum,pageSize,keyword);
    }

}

